<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var twoSum = function(nums, target) {
            for(var i =0;i<nums.length;i++){
                let num = target - nums[i]
                if(nums.indexOf(num)!= -1 &&nums.indexOf(num)!=i){
                  return [i,nums.indexOf(num)]
                }
            }
    };
    console.log(twoSum([3,2,4,0],6))
</script>
</html>